import React from 'react';

import {ProColumns, ProTable} from "@ant-design/pro-table/lib";
import {Modal} from "antd";

export type Props = {
  columns: ProColumns<API.InterfaceInfo>[];
  onCancel: () => void;
  onSubmit: (values: API.InterfaceInfo) => Promise<void>;
  visible: boolean;
};

const CreateModal: React.FC<Props> = (props) => {

  //获取到 Props 的 visible 和 columns
  const { visible, columns, onCancel, onSubmit } = props;
  return (
   <Modal visible={visible} footer={null} onCancel={() => onCancel?.()}>
     <ProTable type="form"
               columns={columns}
               onSubmit={async (value) => onSubmit?.(value)}
     >

     </ProTable>
   </Modal>
  );
};

export default CreateModal;
